Repository Public
1// Vrai-Prix — méthode du coût : relecture d'une estimation sauvegardée (reproductible).2import { NextRequest, NextResponse } from "next/server";3import { getEstimate } from "@/lib/cost/estimate";45export const runtime = "nodejs";67export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) {8 const { id } = await params;9 if (!/^[0-9a-f-]{36}$/.test(id)) return NextResponse.json({ error: "id invalide" }, { status: 400 });10 try {11 const est = getEstimate(id);12 if (!est) return NextResponse.json({ error: "estimation introuvable" }, { status: 404 });13 return NextResponse.json(est, { headers: { "Cache-Control": "private, max-age=3600" } });14 } catch (e) {15 return NextResponse.json({ error: (e as Error).message }, { status: 500 });16 }17}18